package com.mjx.algorithm;

/**
 * 汉诺塔问题
 * Created by meijingxiang on 2017/1/19.
 */
public class Tows {

    public static void doTows(int count,String from, String inter, String to){
        if (count == 1)
            System.out.println("1 " + from + " -> " + to);
        else {
            doTows(count - 1, from, to, inter);
            System.out.println(count +" " + from + " -> " + to);
            doTows(count - 1, inter, from, to);
        }
    }

    public static void main(String[] args) {
        doTows(4,"A","B","C");
    }
}
